﻿CREATE FUNCTION [dbo].[NormalizeDate]( @TheDate smalldatetime) 
RETURNS smalldatetime
AS
BEGIN
	DECLARE @datNowDate smalldatetime

	IF @TheDate IS NULL SET @TheDate = GETDATE()
	SET @datNowDate = cast( floor( cast(@TheDate as float) ) as smalldatetime)
	RETURN @datNowDate
END

